package org.goj.common.entity.practice;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * <p>
 * 题目
 * </p>
 *
 * @author CK
 * @since 2020-12-02
 */
@Data
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
public class Problem implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 题目ID
     */
    @TableId(value = "problem_id", type = IdType.AUTO)
    private Integer problemId;

    /**
     * 标题
     */
    @NotBlank(message = "标题不能为空")
    private String title;

    /**
     * 题目描述
     */
    @NotBlank(message = "题目描述不能为空")
    private String description;

    /**
     * 输入说明
     */
    @NotBlank(message = "输入说明不能为空")
    private String input;

    /**
     * 输出说明
     */
    @NotBlank(message = "输出说明不能为空")
    private String output;

    /**
     * 输入参照
     */
    private String sampleInput;

    /**
     * 输出参照
     */
    @NotBlank(message = "样例输出不能为空")
    private String sampleOutput;

    /**
     * 是否为特别题目
     */
    private String spj;

    /**
     * 暗示
     */
    private String hint;

    /**
     * 来源
     */
    @NotNull(message = "题目分类不能为空")
    private Integer classifyId;

    /**
     * 加入时间
     */
    private Date inDate;

    /**
     * 限时（S）
     */
    @DecimalMax(value = "3.000", message = "时间限制最大为3S")
    @DecimalMin(value = "0.500", message = "时间限制最小为0.5S")
    private Double timeLimit;

    /**
     * 空间限制(kb)
     */
    @Range(min = 32, max = 256, message = "内存限制范围是32-256M")
    private Integer memoryLimit;

    /**
     * 是否屏蔽
     */
    private String defunct;

    /**
     * 总ac次数
     */
    private Integer accepted;

    /**
     * 总提交次数
     */
    private Integer submit;

    /**
     * 解答
     */
    private Integer solved;

    /**
     * ac比例
     */
    private Float ratio;

    @TableField(exist = false)
    private String testInput;

    @TableField(exist = false)
    private List<String> testInputs;

    @NotBlank(message = "测试输出不能为空")
    @TableField(exist = false)
    private String testOutput;

    @TableField(exist = false)
    private List<String> testOutputs;

    @TableField(exist = false)
    private List<Integer> classifyIds;

}
